﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Bitirme.Controllers;

namespace Bitirme.Views
{
    public partial class ShowProjectManagers : System.Web.UI.Page
    {
        private ProjectManagerHandler projectManagerHandler;

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void GridView1_OnRowCommand(object sender, GridViewCommandEventArgs e)
        {
            int rowNum = int.Parse(e.CommandArgument.ToString());
            string choice = e.CommandName;
            string iD = GridView1.Rows[rowNum].Cells[0].Text;

            projectManagerHandler = new ProjectManagerHandler();

            if (choice == "update")
            {
                Response.Redirect("UpdateProjectManager.aspx?id=" + iD);
            }
            else if (choice == "deleteProjectManager")
            {
                projectManagerHandler.DeleteProjectManagerByID(int.Parse(iD));
                Response.Redirect("ShowProjectManagers.aspx");
            }
            else if (choice == "select")
            {
                Response.Redirect("ShowProjectManager.aspx?id=" + iD);
            }
        }
    }
}